<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="./js/ctx.js"></script>
</head>
<body>
<div id="cesiumContainer">
</div>
<script>
    var initCesium = new InitCesium();
    var viewer = initCesium.initViewer('cesiumContainer');
    // An example showing a point cloud tileset classified by a Geometry tileset.

    //Point Cloud by Prof. Peter Allen, Columbia University Robotics Lab. Scanning by Alejandro Troccoli and Matei Ciocarlie.
    var tileset = new Cesium.Cesium3DTileset({
        url: Cesium.IonResource.fromAssetId(5714)
    });
    viewer.scene.primitives.add(tileset);

    // Geometry Tiles are experimental and the format is subject to change in the future.
    // For more details, see:
    //    https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/3d-tiles-next/TileFormats/Geometry
    var classificationTileset = new Cesium.Cesium3DTileset({
        url: '../data/Cesium3DTiles/Classification/PointCloud/tileset.json',
        classificationType: Cesium.ClassificationType.CESIUM_3D_TILE
    });
    viewer.scene.primitives.add(classificationTileset);

    classificationTileset.style = new Cesium.Cesium3DTileStyle({
        color : {
            conditions : [
                ["${id} === 'roof1'", "color('#004FFF', 0.5)"],
                ["${id} === 'towerBottom1'", "color('#33BB66', 0.5)"],
                ["${id} === 'towerTop1'", "color('#0099AA', 0.5)"],
                ["${id} === 'roof2'", "color('#004FFF', 0.5)"],
                ["${id} === 'tower3'", "color('#FF8833', 0.5)"],
                ["${id} === 'tower4'", "color('#FFAA22', 0.5)"],
                ['true', "color('#FFFF00', 0.5)"]
            ]
        }
    });

    viewer.scene.camera.setView({
        destination : new Cesium.Cartesian3(4401448.974612145, 225038.45962842644, 4595135.776680152),
        orientation : {
            heading : 5.36861655457269,
            pitch : -0.4029289137364358
        }
    });

    // Information about the currently highlighted feature
    var highlighted = {
        feature: undefined,
        originalColor: new Cesium.Color()
    };

    // Color a feature yellow on hover.
    viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(movement) {
        // If a feature was previously highlighted, undo the highlight
        if (Cesium.defined(highlighted.feature)) {
            highlighted.feature.color = highlighted.originalColor;
            highlighted.feature = undefined;
        }

        // Pick a new feature
        var pickedFeature = viewer.scene.pick(movement.endPosition);
        if (!Cesium.defined(pickedFeature)) {
            return;
        }

        // Highlight the feature
        highlighted.feature = pickedFeature;
        Cesium.Color.clone(pickedFeature.color, highlighted.originalColor);
        pickedFeature.color = Cesium.Color.YELLOW.withAlpha(0.5);
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

</script>
</body>

</html>